<%@ Page Language="C#" MasterPageFile="~/Master/PlacementManager.master" Theme="YUI"
    StylesheetTheme="YUI" AutoEventWireup="true" CodeFile="ManagePlacementCategories.aspx.cs"
    Inherits="Home_ManagePlacementCategory" Title="PlacementManager: Categories" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div class="yui-b">
            </div>
            <div id="yui-main">
                <div class="yui-b">
                    <h1>
                        Manage Placement Categories</h1>
                    <p>
                        Use this form to manage the broad categories into which placements can be categorised.
                        These categories are used for reporting purposes. Placement categories are specific
                        to Schools or Divisions.</p>
                    <asp:GridView ID="gvCategories" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                        DataSourceID="odsCategories" SkinID="Results" DataKeyNames="CategoryId" OnRowUpdating="gvCategories_RowUpdating"
                        AllowSorting="True">
                        <Columns>
                            <asp:CommandField ButtonType="Image" EditImageUrl="~/Images/Icons/edit.gif" ShowEditButton="True"
                                CancelImageUrl="~/Images/Icons/against.gif" UpdateImageUrl="~/Images/Icons/refresh.gif"
                                CausesValidation="False" />
                            <asp:BoundField DataField="CategoryName" HeaderText="Category Name" SortExpression="CategoryName" />
                            <asp:BoundField DataField="CreatedBy" HeaderText="Created By" SortExpression="CreatedBy"
                                ReadOnly="True" />
                            <asp:BoundField DataField="DateCreated" HeaderText="Date Created" ReadOnly="True"
                                SortExpression="DateCreated" DataFormatString="{0:dddd d MMMM yyyy}" HtmlEncode="False" />
                            <asp:BoundField DataField="UpdatedBy" HeaderText="Updated By" SortExpression="UpdatedBy"
                                ReadOnly="True" />
                            <asp:BoundField DataField="DateUpdated" HeaderText="Date Updated" SortExpression="DateUpdated"
                                ReadOnly="True" DataFormatString="{0:dddd d MMMM yyyy}" HtmlEncode="False" />
                            <asp:BoundField DataField="DivisionId" HeaderText="DivisionId" ReadOnly="True" SortExpression="DivisionId"
                                Visible="False" />
                            <asp:BoundField DataField="CategoryId" HeaderText="CategoryId" SortExpression="CategoryId"
                                ReadOnly="True" Visible="False" />
                        </Columns>
                        <EmptyDataTemplate>
                            No placement categories have been defined for this Division.
                        </EmptyDataTemplate>
                    </asp:GridView>
                    <hr style="height: 1px;" />
                    <span class="formLabel">New Placement Category Name:</span>
                    <asp:TextBox ID="txtNewCategoryName" runat="server"></asp:TextBox>&nbsp;<asp:Button
                        ID="btnAddNewCategory" runat="server" CssClass="inputbutton" OnClick="btnAddNewCategory_Click"
                        Text="Add New Category" />&nbsp;
                    <asp:Label ID="lblNewCategoryMessage" runat="server"></asp:Label>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <!--Object Data Sources ************************************************* -->
    <asp:ObjectDataSource ID="odsCategories" runat="server" DeleteMethod="DeleteAllWDivisionId"
        InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="SelectAllWDivisionId"
        TypeName="PlacementManager.CategoryComponent" UpdateMethod="Update" DataObjectTypeName="PlacementManager.Category"
        SortParameterName="sortExpression">
        <SelectParameters>
            <asp:SessionParameter Name="DivisionId" SessionField="DivisionId" Type="Int32" />
            <asp:Parameter DefaultValue="CategoryName" Name="sortExpression" Type="String" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="CategoryName" Type="String" />
            <asp:Parameter Name="DivisionId" Type="Int32" />
            <asp:Parameter Name="IsActive" Type="Boolean" />
            <asp:Parameter Name="DateCreated" Type="DateTime" />
            <asp:Parameter Name="CreatedBy" Type="String" />
            <asp:Parameter Name="DateUpdated" Type="DateTime" />
            <asp:Parameter Name="UpdatedBy" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>
</asp:Content>
